package com.wolves.career.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wolves.career.entity.UserPermissionsAuthorization;
import com.wolves.career.mapper.UserPermissionsAuthorizationMapper;
import com.wolves.career.service.UserPermissionsAuthorizationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 麦翔盛
 * @since 2021-10-19
 */
@Service
public class UserPermissionsAuthorizationServiceImpl extends ServiceImpl<UserPermissionsAuthorizationMapper, UserPermissionsAuthorization> implements UserPermissionsAuthorizationService {
    @Autowired
    UserPermissionsAuthorizationMapper authorizationMapper;

    @Override
    public boolean existAuthorization(String accountId, String permissionsId) {
        QueryWrapper<UserPermissionsAuthorization> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("account_id", accountId);
        queryWrapper.eq("permissions_id", permissionsId);
        UserPermissionsAuthorization exist = authorizationMapper.selectOne(queryWrapper);
        if (exist != null) {
            //如果存在就返回true
            return true;
        }
        return false;

    }

}
